<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      lang="en" xml:lang="en">
<f:view>
    <h:head>
        <h:outputStylesheet name="style.css"/>
        <h:outputScript name="script/jquery-1.8.3.js"/>
        <h:outputScript name="script/script.js"/>
        <title>
            <ui:insert name="title">Займы</ui:insert>
        </title>
    </h:head>
    <h:body>
        <h:form action="j_security_check">
            <rich:toolbar rendered="#{identity.loggedIn}">
                <a4j:commandLink value="Займы" action="/loans" styleClass="fake-app"/>

                <rich:dropDownMenu>
                    <f:facet name="label">
                        <a4j:commandLink value="Справочники" styleClass="fake-app"/>
                    </f:facet>
                    <rich:menuItem action="/debtors" label="Заниматели" />
                    <rich:menuItem action="/users" label="Пользователи" />
                    <rich:menuItem action="/filials" label="Филиалы" rendered="#{identity.hasRole('admin', 'default', 'default')}"/>
                </rich:dropDownMenu>

                <rich:dropDownMenu>
                    <f:facet name="label">
                        <h:panelGroup>
                            <a4j:commandLink value="Отчёты" styleClass="fake-app"/>
                        </h:panelGroup>
                    </f:facet>
                    <!--<rich:menuItem action="/reports" label="ntc" />-->
                    <rich:menuItem label="Реестр займов" action="/reports/registryOfLoans"/>

                </rich:dropDownMenu>

                <rich:toolbarGroup location="right" >
                    <rich:dropDownMenu style="padding: 1px;" popupWidth="50">
                        <f:facet name="label">
                            <h:panelGroup>
                                <a4j:commandLink value="#{identity.user.id}" styleClass="fake-app"/>
                            </h:panelGroup>
                        </f:facet>
                        <rich:menuItem label="Выход" action="#{securityController.logout}" />
                    </rich:dropDownMenu>
                </rich:toolbarGroup>
            </rich:toolbar>
        </h:form>
        <div class="content">
            <ui:insert name="content"/>
        </div>
        <div class="footer fake-app">
            <div style="margin: 10px;">
                <rich:messages ajaxRendered="true" />
            </div>
        </div>
        <a4j:status startStyleClass="popup_overlay">
            <f:facet name="start">
                <h:graphicImage value="/resources/img/ajax-loader.gif" alt="ai" styleClass="popup-ajax-loader" />
            </f:facet>
        </a4j:status>
    </h:body>
</f:view>
</html>
